const path = require("path");
const baseConfig = require("./webpack.base");
const merge = require("webpack-merge");
const HardSourceWebpackPlugin = require("hard-source-webpack-plugin");
const express=require('express');

let config = {
  mode: "development",
  devtool: "source-map",
  devServer: {
    contentBase: path.resolve(__dirname, "../dist"),
    writeToDisk: true,//是否写入硬盘
    port: 8080,
    open: false,
    historyApiFallback: true, //BrowserRouter时刷新会报404错误，重定向到index.html
  },
  plugins:[
    new HardSourceWebpackPlugin.ExcludeModulePlugin([
      {
        test: /mini-css-extract-plugin[\\/]dist[\\/]loader/, //devServer模式下不兼容mini-css-extract-plugin
      },
    ]),
  ]
};
module.exports = merge(baseConfig, config);
